<template>
	<view>
		<z-paging ref="paging" v-model="list" @query="getList" :empty-view-fixed="false" :default-page-size="limit">
			<view class="tab-view" slot="top">
				<v-tabs
					color="#999"
					activeColor="#000"
					lineHeight="6rpx"
					lineColor="#000"
					lineRadius="12rpx"
					:lineScale="0.2"
					v-model="current"
					:tabs="tabs"
					field="name"
					@change="changeTab"
					:scroll="false"
				></v-tabs>
			</view>
			<view style="height: 20rpx;"></view>
			<view class="goods-list" v-if="current == 0 || current == 3">
				<view class="goods-item flex-row-center" v-for="(item, index) in list" :key="index">
					<image :src="`/static/home/${item.active ? 'ic_xz' : 'ic_xz1'}.png`" mode="aspectFill" class="img-choose" v-if="current == 0" @click="onChoose(item)"></image>
					<image :src="item.img" mode="aspectFill" class="store-goods-img"></image>
					<view class="store-right-info flex-col">
						<view class="store-goods-title ellipsis">{{ item.name }}</view>
						<view style="flex: 1"></view>
						<view class="price-view flex-row-between">
							<view class="price-text">
								￥
								<text>{{ item.price }}</text>
							</view>

							<view class="shuliang" v-if="!item.active">x{{ item.num }}</view>
							<view class="num-view flex-row-center" v-else>
								<view class="num-opt-view flex-center" @click.stop="onNumChange('jian', item)">-</view>
								<view class="num flex-center">{{ item.num }}</view>
								<view class="num-opt-view flex-center" @click.stop="onNumChange('jia', item)">+</view>
							</view>
						</view>
					</view>
				</view>
			</view>

			<view class="goods-list" v-else>
				<view class="goods-item" v-for="(item, index) in list" :key="index">
					<view class="goods-cell flex-row-center" v-for="(cell, i) in item.list" :key="i">
						<image :src="cell.img" mode="aspectFill" class="store-goods-img"></image>
						<view class="store-right-info flex-col">
							<view class="store-goods-title ellipsis">{{ cell.name }}</view>
							<view style="flex: 1"></view>
							<view class="price-view flex-row-between">
								<view class="price-text">
									￥
									<text>{{ cell.price }}</text>
								</view>

								<view class="shuliang">x{{ cell.num }}</view>
							</view>
						</view>
					</view>

					<view class="order-item-bottom flex-col">
						<view class="all-price">
							共{{ item.num }}件商品 合计:
							<text>￥{{ item.price }}</text>
						</view>
						<view class="flex-row-center">
							<view
								class="order-btn"
								@click.stop="onCancel(item)"
								v-if="current == 2"
								@click="
									$navTo('pages/mine/logistics/logistics', {
										orderId: item.id
									})
								"
							>
								查看物流
							</view>
							<view class="order-btn" @click.stop="onShouhuo(item)" v-if="current == 2">确认收货</view>
							<view class="order-btn" @click.stop="onComment(item)" v-if="current == 4 && item.pingjia == 0">去评价</view>
						</view>
					</view>
				</view>
			</view>
		</z-paging>

		<view class="opt-view flex-row-center" v-if="current == 0">
			<image :src="`/static/home/${allChoose ? 'ic_xz' : 'ic_xz1'}.png`" mode="aspectFill" class="img-choose" @click="onAllChoose"></image>
			<text class="choose-text">全选</text>

			<view class="opt-btn flex-center" @click="onRecovery">立即回收</view>
			<view class="opt-btn flex-center send-btn" @click="onSend">立即发货</view>
		</view>
		<view style="height: 100rpx;" v-if="current == 0"></view>

		<show-modal></show-modal>
	</view>
</template>

<script src="./store.js"></script>

<style lang="scss">
@import '@/style/common.scss';
@import './store.scss';
@import '../manghe/manghe.scss';
</style>
